﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QStyleOption>
#include <QPainter>
#include <QMainWindow>
#include <QStackedWidget>
#include <QMouseEvent>
#include<QPushButton>
#include <QLabel>
#include "page1.h"
#include "page2.h"
#include "page3.h"
#include "page4.h"
#include "page5.h"
#include "page6.h"
#include "page7.h"
#include "page8.h"
#include "page9.h"
#include "page10.h"
#include "page11.h"
#include "page12.h"
#include"page13.h"
//#include"ConnectionDialog.h"
#include"databaseManager.h"

// Include other page headers here (page3.h, page4.h, ..., page12.h)
class Page2;
class Page3;
class Page4;
class Page5;
class Page6;
class Page7;
class Page8;
class Page9;
class Page10;
class Page11;
class Page12;
class Page13;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget* parent = nullptr);
    ~MainWindow();

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;


signals:
    void warehouse();
    void sales();
    void finance();
    void LoadingQcharts();
    void LoadingQcharts2();
    void LoadingQcharts3();
    void initialize();
    void updateWidget();
    void updateOrderWidget();
    void updateConnect();
    void updateEmploy();

private slots:
    void nextPage();
    void frontPage();
    void pageRequested1();
    void orderRequested();
    void productionRequested();
    void storeRequested();
    void financeRequested();
    void pageRequested6();
    void pageRequested7();
    void pageRequested8();
    void pageRequested9();
    void pageRequested10();
    void pageRequested11();
    void pageRequested13();

    void onWarehouseLogin();
    void onSalesLogin();
    void addEmployeeRequested();

    void on_minimizeButton_clicked();
      void on_maximizeButton_clicked();
      void on_closeButton_clicked();

private:
    QStackedWidget* stackedWidget;
    Page1* page1;
    Page2* page2;
    Page3* page3;
    Page4* page4;
    Page5* page5;
    Page6* page6;
    Page7* page7;
    Page8* page8;
    Page9* page9;
    Page10* page10;
    Page11* page11;
    Page12* page12;
Page13*page13;
QPoint m_dragPosition;
    bool m_dragging;
    QWidget *titleBar;
    QPushButton *minimizeButton;
    QPushButton *maximizeButton;
    QPushButton *closeButton;
    QLabel *titleLabel;
};

#endif // MAINWINDOW_H
